package homework;

import javax.management.relation.Role;
import java.util.ArrayList;

public class test {
    public interface RoleService {
         void addRole(Role role);
         ArrayList<Role> getRole();
    }


    public static class Role {

        private String name;
        //角色名称
        private String dsec;
        //角色描述

        public Role(String name,String dsec){
            this.name=name;
            this.dsec=dsec;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getDsec() {
            return dsec;
        }

        public void setDsec(String dsec) {
            this.dsec = dsec;
        }

    }

    public static class RoleServiceImpl implements RoleService {
        private ArrayList<Role> ROLES;


        public RoleServiceImpl() {
            ROLES = new ArrayList<>();//ArrayList属于引用类型
        }

        @Override
        public void addRole(Role role) {
            ROLES.add(role);
        }

        @Override
        public ArrayList<Role> getRole() {
            return ROLES;
        }
    }

}









